﻿* The economic effects of international administrations: The cases of Kosovo and East Timor
* by César Urquizo and Diego Winkelried (Universidad del Pacífico, www.up.edu.pe)
* Economic Development and Cultural Change (2019)
* https://doi.org/10.7910/DVN/ENX8VL

*----------------------------------------------------------------------------------
*0. Getting ready
*----------------------------------------------------------------------------------
clear
clear matrix
clear mata
set more off

ssc install synth
ssc install mat2txt

*----------------------------------------------------------------------------------
*1. Loading data set
*----------------------------------------------------------------------------------
* cd "C:\Empirical"
use DataUW2019.dta

*--------------------------------------------------------------------------------
*2. Define treatment unit, treatment period and outcome variable  
*--------------------------------------------------------------------------------
* Treatment Unit and period (Kosovo = 85, East Timor = 158)
global tru_trp "trunit(85) trperiod(2000) fig" 

* Outcome variable
global yvar "ln_gni_pcft"

* Lagged outcome variable
global laggedyvar "ln_gni_pcft(1990) ln_gni_pcft(1995) ln_gni_pcft(2000)"

*----------------------------------------------------------------------------------
*3. Define covariates
*----------------------------------------------------------------------------------
* All covariates
global covars    "ln_densp dep_ratio fert_rate life_exp gcf_pbi100 share_ag100 share_const100 share_man100 share_min100 share_transp100 share_wholesale100"

* Non-outlying covariates
global no_covars "ln_densp           fert_rate life_exp gcf_pbi100 share_ag100                share_man100 share_min100 share_transp100 share_wholesale100"

*--------------------------------------------------------------------------------
*4. Model estimation 
*--------------------------------------------------------------------------------
* Model with the complete donor pool and non-outlying covariates
synth $yvar $laggedyvar $no_covars, $tru_trp 

* Saving important results
mat matriz_V1 = [e(V_matrix)]
mat matriz_W1 = [e(W_weights)]
mat y_temp    = [e(Y_treated)],[e(Y_synthetic)]
mat2txt, matrix(matriz_V1) saving(matrix_V_kosovo.txt) replace
mat2txt, matrix(matriz_W1) saving(matrix_W_kosovo.txt) replace

* Model with regional control group and non-outlying covariates
synth $yvar $laggedyvar $no_covars, $tru_trp counit(21 39 95 106 139 144)

* Model with the complete donor pool and all covariates
synth $yvar $laggedyvar covars, $tru_trp